from django import forms

from TransportationManagement.models import Car, Driver, Proposer, Accident, Record


class UserForm(forms.Form):
    name = forms.CharField(max_length=20)
    password = forms.PasswordInput()


class MyForm(forms.Form):
    pass


class RegisterForm(forms.Form):
    gender = (
        ('male', "男"),
        ('female', "女"),
    )
    username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control'}))
    password1 = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password2 = forms.CharField(label="确认密码", max_length=256,
                                widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    email = forms.EmailField(label="邮箱地址", widget=forms.EmailInput(attrs={'class': 'form-control'}))


class DriverForm(forms.ModelForm):
    class Meta:
        model = Driver
        fields = '__all__'


class CarForm(forms.ModelForm):
    class Meta:
        model = Car
        fields = '__all__'


class ProposerForm(forms.ModelForm):
    class Meta:
        model = Proposer
        exclude = ['Date']


class RecordForm(forms.ModelForm):
    class Meta:
        model = Record
        fields = '__all__'


class AccidentForm(forms.ModelForm):
    class Meta:
        model = Accident
        fields = '__all__'

